package com.qiaofang.constant;

import com.qiaofang.common.utils.StringUtil;

public enum BatchStatusEnum {
    visited("到访", 0),
    payDeposit("认筹", 1),
    subscribe("认购", 2),
    sign("签约", 3);
    private final String key;

    private final int value;

    BatchStatusEnum(String key, int value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public int getValue() {
        return value;
    }

    public static BatchStatusEnum getByKey(String key) {
        if (StringUtil.isBlank(key)) {
            return null;
        }
        for (BatchStatusEnum value : values()) {
            if (value.getKey().equals(key)) {
                return value;
            }
        }
        return null;
    }


    /**
     * 状态要满足 到访 认筹 认购 签约
     *
     * @param status
     * @return
     */
    public static boolean checkStatus(String status) {
        String STATUS = "到访,认筹,认购,签约";
        return StringUtil.contains(STATUS, status);
    }

}
